<template>
  <div class>
    <el-checkbox
      v-for="(v, i) in gettags"
      :key="`${i}weixin-tags1`"
      v-model="checked"
      :value="v.id"
    >{{v.name}}</el-checkbox>
    <!-- <br />
    <el-popover placement="top" width="160" v-model="visible">
      <el-input size="mini" v-model="newtags">
        <template slot="append">
          <el-button type="primary" size="mini" @click="handleEdit">确定</el-button>
        </template>
      </el-input>
      <el-button type="text" @click="visible = true" slot="reference">新建标签</el-button>
    </el-popover> -->
  </div>
</template>

<script>
import { mapGetters } from "vuex";
export default {
  data() {
    return {
      checked: [],
      newtags: "",
      visible: false
    };
  },
  mounted() {
    this.strat();
  },
  watch: {
    tagscard() {
      this.start();
    },
    checked(v) {
      this.setchecked(v);
    }
  },
  methods: {
    async handleEdit() {
      this.visible = false;
    },
    strat() {
      if (this.selectUser.length === 1) {
        this.checked = this.getfans.find(v => v.tagid_list);
      } else {
        this.checked = [];
      }
    }
  },
  computed: {
    ...mapGetters("weixin", ["gettags"])
  },
  props: ["getfans", "tagscard", "selectUser", "setchecked"],
  name: "weixin-tags"
};
</script>